//
//  ZCXUserDetialView.m
//  LoveOfPet
//
//  Created by dllo on 15/11/17.
//  Copyright © 2015年 孔维. All rights reserved.
//

#import "ZCXUserDetialView.h"
#import <UIImageView+WebCache.h>
#import <SDWebImageManager.h>
#define HEIGHT  [[UIScreen mainScreen]bounds].size.height / 667
#define WIDTH   [[UIScreen mainScreen]bounds].size.width / 375
@interface ZCXUserDetialView ()
@property (nonatomic, retain) UIImageView *userImageV;
@property (nonatomic, retain) UILabel *userNameLabel;
@property (nonatomic, retain) UILabel *feelLabel;
@property (nonatomic, retain) UILabel *beautyLabel;
@end

@implementation ZCXUserDetialView
- (void)dealloc{
    [_userImageV release];
    [_userNameLabel release];
    [_feelLabel release];
    [_beautyLabel release];
    [_userDetial release];
    [super dealloc];
}
- (id)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        self.userImageV = [[UIImageView alloc]initWithFrame:CGRectMake(10 * WIDTH, 25 * HEIGHT, 60 * WIDTH, 60 * HEIGHT)];
        _userImageV.layer.masksToBounds = YES;
        _userImageV.layer.cornerRadius = 30 * WIDTH;
        [self addSubview:_userImageV];
        [_userImageV release];
        
        self.userNameLabel = [[UILabel alloc]initWithFrame:CGRectMake(15 * WIDTH + _userImageV.frame.size.width, 25 * HEIGHT, 200 * WIDTH, 20 * HEIGHT)];
        [self addSubview:_userNameLabel];
        [_userNameLabel release];
        
        self.feelLabel = [[UILabel alloc]initWithFrame:CGRectMake(15 * WIDTH + _userImageV.frame.size.width, 30 * HEIGHT + _userNameLabel.frame.size.height, 200 * WIDTH, 40 * HEIGHT)];
        [self addSubview:_feelLabel];
        [_feelLabel release];
    }
    return self;
}
- (void)setUserDetial:(ZCXUserDetial *)userDetial{
    if (_userDetial != userDetial) {
        [_userDetial release];
        _userDetial = [userDetial retain];
    }
    [self.userImageV sd_setImageWithURL:[NSURL URLWithString:userDetial.avatar]];
    self.userNameLabel.text = userDetial.screen_name;
    self.feelLabel.text = [NSString stringWithFormat:@"ID:%@", userDetial.ID];
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
